#pragma once

#include <QList>
#include <QMap>
#include <memory>

#include "CharType.h"
#include "Action.h"
#include "TransferFwd.h"
#include "StateFwd.h"

class Machine;
typedef QMap<CharTypePtr, TransferPtr> TransferMap; 

class State
{
public:
    void ProcessChars(CharTypePtr character);
    void CancelActions();
    void PerformActions();

public:
    void RegisterTransfer(TransferPtr transfer, const CharTypeList& charList);
    void AddAction(ActionPtr action);
    void SetMachine(Machine* m);
    CharTypePtr CurrentChar();
    CharTypeList Chars();

private:
    ActionVector _actions;
    TransferMap  _transfersMap;
    Machine*     _machine;
    CharTypePtr  _currentChar;
};